home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5433 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.6 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Unbuffered character input...
  5. Date: Mon, 12 Feb 96 16:02:26 GMT
  6. Organization: none
  7. Message-ID: <824140946snz@genesis.demon.co.uk>
  8. References: <Pine.SGI.3.91.960129190205.27936A-100000@tahiti.cs.unm.edu> <9602022043.AA13287@dxmint.cern.ch> <4f7hlf$87n@airdmhor.gen.nz> <9602061701.AA21789@dxmint.cern.ch> <4f8kat$ofv@solutions.solon.com> <823794347snz@genesis.demon.co.uk> <danpop.823811815@rscernix>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <danpop.823811815@rscernix> danpop@mail.cern.ch "Dan Pop" writes:
  15.  
  16. >In <823794347snz@genesis.demon.co.uk> Lawrence Kirby <fred@genesis.demon.co.uk>
  17. > writes:
  18. >
  19. >>In article <4f8kat$ofv@solutions.solon.com>
  20. >>           seebs@solutions.solon.com "Peter Seebach" writes:
  21. >>
  22. >>>In article <9602061701.AA21789@dxmint.cern.ch>,
  23. >>>Dan Pop  <danpop@mail.cern.ch> wrote:
  24. >>>>But even on systems where it is not, it still saves processor time.
  25. >>>>The cpu overhead of making a single OS call to get a complete line of input
  26. >>>>is smaller (sometimes significantly smaller) than the overhead of making
  27. >>>>N OS calls, one for each character of the line.  The stdio library tries
  28. >>>>to do its best to minimize the number of (expensive) OS calls.
  29. >>
  30. >>The stdio library typically reads characters as soon as they are available
  31. >>so it does very little in this respect except provide suitable buffering
  32. >>when more than one character happens to be available on a read. This is
  33. >>clearly significant for file I/O but whether terminal I/O makes user typed
  34. >>characters immediately available or not is usually purely a function of the
  35. >>OS. Setting line buffering on input streams on many/most stdio libraries
  36. >>doesn't do anything special.
  37. >
  38. >Because the line buffering is performed by the tty driver.  The tty driver
  39. >won't (unless explicitly asked) make characters available as soon as they
  40. >are typed and the stdio library doesn't attempt to get them as soon as
  41. >they're typed.  It looks like line buffered terminal input to me, unless 
  42. >I'm missing something.
  43.  
  44. (Much quoting but this is all rather context-sensitive)
  45.  
  46. Agreed. My point was simply to stress that in this case this is not a
  47. function of stdio, rather it is a function of the tty driver.
  48.  
  49. -- 
  50. -----------------------------------------
  51. Lawrence Kirby | fred@genesis.demon.co.uk
  52. Wilts, England | 70734.126@compuserve.com
  53. -----------------------------------------
  54.